<%-- 
    Document   : listVehicleBookings
    Created on : May 22, 2009, 1:31:06 PM
    Author     : Administrator
--%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<%@page contentType="text/html"%>
<%@page pageEncoding="UTF-8"%>
<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@taglib prefix="f" uri="http://java.sun.com/jsf/core"%>
<%@taglib prefix="h" uri="http://java.sun.com/jsf/html"%>
<c:set var="title" value="List Vehicle Bookings" scope="page"/>

<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title>${title}</title>
    </head>
    <body>
        <h1>${title}</h1>
        <f:view>
            <!-- Show error messages -->
            <h:form id="frmNotification">
                <h:inputHidden id="hdnGeneralVehicleBookingSuccessNotification" ></h:inputHidden>
                <h:message showSummary="true" showDetail="true" style="color: blue; font-family: 'New Century Schoolbook', serif; font-style: oblique" for="hdnGeneralVehicleBookingSuccessNotification"/>

                <h:inputHidden id="hdnGeneralVehicleBookingErrorNotification" ></h:inputHidden>
                <h:message showSummary="true" showDetail="true" style="color: red; font-family: 'New Century Schoolbook', serif; font-style: oblique" for="hdnGeneralVehicleBookingErrorNotification"/>
            </h:form>

            <a href="addVehicleBooking.jsp">Add new vehicle booking</a>
            <h:form>
                <h:dataTable id="vehicleBookingsTable" value="#{VehicleBookingJSFManagedBean.vehicleBookings}" var="vehicleBooking">
                    <h:column>
                        <f:facet name="header">
                            <h:outputText value="Customer name"/>
                        </f:facet>
                        <h:outputText value="#{vehicleBooking.customerName}"/>
                    </h:column>
                    <h:column>
                        <f:facet name="header">
                            <h:outputText value="Contact name"/>
                        </f:facet>
                        <h:outputText value="#{vehicleBooking.contactName}"/>
                    </h:column>
                    <h:column>
                        <f:facet name="header">
                            <h:outputText value="Contact phone"/>
                        </f:facet>
                        <h:outputText value="#{vehicleBooking.contactPhone}"/>
                    </h:column>
                    <h:column>
                        <f:facet name="header">
                            <h:outputText value="Contact email"/>
                        </f:facet>
                        <h:outputText value="#{vehicleBooking.contactEmail}"/>
                    </h:column>
                    <h:column>
                        <f:facet name="header">
                            <h:outputText value="Pickup date"/>
                        </f:facet>
                        <h:outputText value="#{vehicleBooking.pickUpDate}">
                            <f:convertDateTime pattern="dd/MM/yyyy" />
                        </h:outputText>
                    </h:column>
                    <h:column>
                        <f:facet name="header">
                            <h:outputText value="Booking type"/>
                        </f:facet>
                        <h:outputText value="#{vehicleBooking.bookingType.code}"/>
                    </h:column>
                    <h:column>
                        <f:facet name="header">
                            <h:outputText value="Event type"/>
                        </f:facet>
                        <h:outputText value="#{vehicleBooking.eventType.code}"/>
                    </h:column>
                    <h:column>
                        <f:facet name="header">
                            <h:outputText value="Vehicle type"/>
                        </f:facet>
                        <h:outputText value="#{vehicleBooking.vehicleType.code}"/>
                    </h:column>
                    <h:column>
                        <f:facet name="header">
                            <h:outputText value="Driver assigned"/>
                        </f:facet>
                        <h:outputText value="#{vehicleBooking.driver.username}"/>
                    </h:column>
                    <h:column>
                        <f:facet name="header">
                            <h:outputText value="Vehicle assigned"/>
                        </f:facet>
                        <h:outputText value="#{vehicleBooking.vehicle.name}"/>
                    </h:column>
                    <h:column>
                        <f:facet name="header">
                            <h:outputText value="By client"/>
                        </f:facet>
                        <h:outputText value="#{vehicleBooking.corporateClient.username}"/>
                    </h:column>
                    <h:column>
                        <f:facet name="header">
                            <h:outputText value="Actions"/>
                        </f:facet>
                        <h:commandLink value="Edit" action="#{VehicleBookingJSFManagedBean.editVehicleBooking}">
                            <f:param name="vehicleBookingId" value="#{vehicleBooking.id}"/>
                        </h:commandLink>
                        <h:outputText value="  |  "/>
                        <h:commandLink value="Delete" action="#{VehicleBookingJSFManagedBean.deleteVehicleBooking}">
                            <f:param name="vehicleBookingId" value="#{vehicleBooking.id}"/>
                        </h:commandLink>
                        <h:outputText value="  |  "/>
                        <h:commandLink value="Assign" action="#{VehicleBookingJSFManagedBean.assignVehicleBooking}">
                            <f:param name="vehicleBookingId" value="#{vehicleBooking.id}"/>
                        </h:commandLink>
                    </h:column>
                </h:dataTable>
            </h:form>
        </f:view>
    </body>
</html>